/*
 * @Description:
 * @Author: maxyang
 * @Date: 2022-05-19 15:44:41
 * @LastEditTime: 2022-06-28 20:27:41
 * @LastEditors: liutq
 * @Reference:
 */
package common

import (
	"github.com/gin-gonic/gin"
)

func ResponseToJson(sysCode int, opcode int, msg string, c *gin.Context) {
	c.JSON(sysCode, gin.H{
		"code": opcode,
		"msg":  msg,
	})
}

func ResponseListToJson(sysCode int, Page int, PerPage int, Total int, Data interface{}, c *gin.Context) {
	c.JSON(sysCode, gin.H{
		"code":    Ok,
		"msg":     "success",
		"Page":    Page,
		"PerPage": PerPage,
		"Total":   Total,
		"Data":    Data,
	})
}

func ResponseDetailToJson(sysCode int, Data interface{}, msg string, c *gin.Context) {
	c.JSON(sysCode, gin.H{
		"code": Ok,
		"msg":  "success",
		"Data": Data,
	})
}
